package com.adingxiong.springsecurityoauth2.controller;

import com.adingxiong.springsecurityoauth2.result.Response;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName OauthController
 * @Description TODO
 * @Author xiongchao
 * @Date 2020/10/29 14:09
 **/
@RestController
public class OauthController {


    @GetMapping("/getCode")
    public Response getCode (HttpServletResponse response, HttpServletRequest request){
        return new Response()
                .put("code" ,request.getParameter("code"))
                .put("state" ,request.getParameter("state"));
    }


    @GetMapping("/authentication")
    public Response authentication(Authentication authentication){
        return new Response().data(authentication);
    }
}
